import Vue from 'vue'
import App from './components/App.vue'
import Routers from './router'
import {sync} from 'vuex-router-sync'
import VueRouter from 'vue-router'
import Util from './lib/util'


Vue.use(VueRouter)
// router config
const RouterConfig = {
  mode: 'history',
  routes: Routers
}
const router = new VueRouter(RouterConfig)

router.beforeEach((to, from, next) => {
  Util.title(to.meta.title)
  let requireAuth = to.meta.requireAuth
  if (requireAuth) {

  }
  next()
})

router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
})
//sync(store, router)

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
